import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:grocery_app_demo/core/utils/global.dart';

import 'app_routes.dart';

class AuthMiddleware extends GetMiddleware {
  @override
  RouteSettings? redirect(String? route) {
    if (Global.token.isNotEmpty) {
      return super.redirect(route);
    }
    return const RouteSettings(name: AppRoutes.loginPage);
  }
}
